<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>检测文件的 MIME 类型</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.mime-content-type" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mime_content_type</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">mime_content_type</span> &mdash; <span class="dc-title">检测文件的 MIME 类型</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.mime-content-type-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mime_content_type</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
    返回通过使用  <var class="filename">magic.mime</var> 
    检测到的文件 MIME 类型。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mime-content-type-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">filename</code></dt>

     <dd>

      <p class="para">
       要检测的文件名。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mime-content-type-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回文件的 MIME 内容类型，例如
   <em>text/plain</em> 或 <em>application/octet-stream</em>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mime-content-type-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2760">
    <p><strong>Example #1 <span class="function"><strong>mime_content_type()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">mime_content_type</span><span style="color: #007700">(</span><span style="color: #DD0000">'php.gif'</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">mime_content_type</span><span style="color: #007700">(</span><span style="color: #DD0000">'test.php'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
image/gif
text/plain
</pre></div>
    </div>
   </div>
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.mime-content-type-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="finfo.file.html" class="function" rel="rdfs-seeAlso">finfo_file()</a> - 别名 finfo_file()</span></li>
    <li class="member"><span class="function"><a href="finfo.buffer.html" class="function" rel="rdfs-seeAlso">finfo_buffer()</a> - 别名 finfo_buffer()</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>